#ifndef CLIENTSOCK_H
#define CLIENTSOCK_H

#include"src/include/Socket.h"
#include"agreement.h"
#include<thread>
#include<mutex>
#include"src/include/ThreadPool.h"
#include<memory>

class Client
{
private:
    //初始化网络
    Socket clntsocket;
    int clnt_fd;

    //单例模式
    Client(const Client&) = delete;
    Client& operator=(const Client&) = delete;
    //线程池用于处理文件的读写操
    ThreadPool *thPool;

public:
    Client();
    ~Client();
    static Client& getInstance();

    void setThreapool(ThreadPool &pool);
    void stopThreadPool();

//    发送数据
    void sendData(const CloudDrive::Packet& packet);

    void recvivData();

    int getSockfd();

    void connectSever();

    void addFunc(std::function<void()>);

};

#endif // CLIENTSOCK_H
